<?php

namespace App\Controller;

use App\Library\System\Model\LanguageModel;

/**
 * Language Controller
 *
 * @category   Controller
 * @package    App\Controller
 * @author     Nam Vo <vhnam@peslook.com>
 * @copyright  Peslook
 * @version    1.0
 * @since      Class available since Release 1.0
 */
class LanguageController extends BaseController
{
    /**
     * Current language
     *
     * @var string
     */
    private $language;

    /**
     * Constructor
     *
     */
    public function __construct()
    {

    }

    /**
     * Index action
     *
     * @route /skill/category/{alias}
     * @return array|void ViewModel
     */
    public function indexAction()
    {
        $alias = $this->route('alias');
        $language = new LanguageModel($alias);

        if (!$language->isValid()) {
            $this->go('/');
        }

        $_SESSION['app_lang'] = $alias;
        $this->go('/');
    }
}
